package com.lizhen.j2eepattern.interceptingfilterpattern;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class FilterChain {
    private List<Filter> filters = new ArrayList();
    private Target target;

    public FilterChain() {
    }

    public void addFilter(Filter filter) {
        this.filters.add(filter);
    }

    public void execute(String request) {
        Iterator var3 = this.filters.iterator();

        while (var3.hasNext()) {
            Filter filter = (Filter) var3.next();
            filter.execute(request);
        }

        this.target.execute(request);
    }

    public void setTarget(Target target) {
        this.target = target;
    }
}
